
#ifndef _VECF_BI
#define _VECF_BI

#include once "chipmunk41/chipmunk.bi"
#include once "mathf.bi"


type matrix_ as matrix

type vec2f
    
	declare constructor ( byval x as single, byval y as single )
	declare constructor ( byval x as double, byval y as double )
	declare constructor ( byref v2d as vec2f )
	declare constructor ( )
    
    x as MATH_PRECISION
    y as MATH_PRECISION
    
    declare operator cast() as string
    
    declare operator cast() as cpVect
    declare operator cast() as cpVect ptr
    declare operator let( byref v as cpVect )

    
    declare function dot ( byref v as vec2f ) as MATH_PRECISION
    declare function magnitude() as MATH_PRECISION
    declare sub normalize()
    declare function UnitVec() as vec2f
    declare function cross( byref v as vec2f ) as vec2f
    declare function cross_analog( byref v as vec2f ) as MATH_PRECISION
    declare function distance( byref v as vec2f ) as MATH_PRECISION
    declare function AngleBetween( byref v as vec2f ) as MATH_PRECISION
    
end type


type vec3f
    
	declare constructor ( byval x as single, byval y as single, byval z as single )
	declare constructor ( byref v3d as vec3f )
	declare constructor ( )
    
    x as MATH_PRECISION
    y as MATH_PRECISION
    z as MATH_PRECISION
    
    declare operator Cast() as string
    declare operator Cast() as vec2f
    declare operator *= ( byref rhs as matrix_ )
    declare operator *= ( byref s as single )
    
    declare operator +=( byref rhs as vec3f )
    
    declare function dot ( byref v as vec3f ) as MATH_PRECISION
    declare function magnitude() as MATH_PRECISION
    declare sub normalize()
    declare function UnitVec() as vec3f
    declare function cross( byref v as vec3f ) as vec3f
    declare function distance( byref v as vec3f ) as MATH_PRECISION
    declare function AngleBetween( byref v as vec3f ) as MATH_PRECISION
    
end type


type vec4f
    
	declare constructor ( byval x as single, byval y as single, byval z as single, byval w as double )
	declare constructor ( byref v4d as vec4f )
	declare constructor ( )
    
    x as MATH_PRECISION
    y as MATH_PRECISION
    z as MATH_PRECISION
    w as MATH_PRECISION
    
    declare operator Cast() as string
    declare operator Cast() as vec3f
    declare operator *= ( byref rhs as matrix_ )
    
    declare function dot ( byref v as vec4f ) as MATH_PRECISION
    declare function magnitude() as MATH_PRECISION
    declare sub normalize()
    declare function UnitVec() as vec4f
    declare function cross( byref v as vec4f ) as vec4f
    declare function distance ( byref v as vec4f ) as MATH_PRECISION
    
end type


declare operator + ( byref lhs as vec2f, byref rhs as single ) as vec2f
declare operator + ( byref lhs as vec2f, byref rhs as vec2f ) as vec2f



declare operator + ( byref lhs as vec3f, byref rhs as single ) as vec3f
declare operator + ( byref lhs as vec3f, byref rhs as vec3f ) as vec3f

declare operator + ( byref lhs as vec3f, byref rhs as double ) as vec4f
declare operator + ( byref lhs as vec4f, byref rhs as vec4f ) as vec4f
declare operator + ( byref lhs as vec4f, byref rhs as single ) as vec4f



declare operator - ( byref lhs as vec2f, byref rhs as vec2f ) as vec2f

declare operator - ( byref lhs as vec3f ) as vec3f
declare operator - ( byref lhs as vec3f, byref rhs as vec3f ) as vec3f
declare operator - ( byref lhs as vec3f, byref rhs as vec4f ) as vec3f
declare operator - ( byref lhs as vec3f, byref rhs as single ) as vec3f

declare operator - ( byref lhs as vec4f, byref rhs as vec4f ) as vec4f



declare operator * ( byref lhs as vec2f, byref rhs as vec2f ) as vec2f
declare operator * ( byref lhs as vec2f, byref rhs as single ) as vec2f
declare operator * ( byref lhs as vec2f, byref rhs as double ) as vec2f

declare operator * ( byref lhs as vec3f, byref rhs as vec3f ) as vec3f
declare operator * ( byref lhs as vec3f, byref rhs as vec4f ) as vec3f
declare operator * ( byref lhs as vec3f, byref rhs as double ) as vec3f
declare operator * ( byref lhs as vec3f, byref rhs as single ) as vec3f

declare operator * ( byref lhs as vec4f, byref rhs as vec4f ) as vec4f
declare operator * ( byref lhs as vec4f, byref rhs as single ) as vec4f



declare operator / ( byref lhs as vec2f, byref rhs as vec2f ) as vec2f
declare operator / ( byref lhs as vec2f, byref rhs as integer  ) as vec2f
declare operator / ( byref lhs as vec2f, byref rhs as single   ) as vec2f
declare operator / ( byref lhs as vec2f, byref rhs as double   ) as vec2f


declare operator / ( byref lhs as vec3f, byref rhs as vec3f ) as vec3f
declare operator / ( byref lhs as vec3f, byref rhs as single ) as vec3f
declare operator / ( byref lhs as vec3f, byref rhs as double ) as vec3f


declare operator / ( byref lhs as vec4f, byref rhs as vec4f ) as vec4f
declare operator / ( byref lhs as vec4f, byref rhs as single ) as vec4f

#endif